Make Zabbix agent argument errors say which fix is needed - #4
Open
MarkLFT wants to merge 1 commit into
Open
Conversation
Running the Linux Zabbix agent script from TacticalRMM against a newly onboarded
site failed with 'ERROR: ZabbixProxy and ZabbixServer are required', which does
not say what to do — and fires for three different causes needing three
different fixes.
Traced through the TacticalRMM source: parse_script_args passes an argument
through unaltered when the resolved value is falsy, and get_db_value falls back
to the custom field's default_value when the site has no saved value. So the
failure modes reach the script differently:
- empty value -> the custom field exists but is blank for this site
- literal {{...}} -> no custom field / Key Store entry is defined at all
- no arguments -> the script's Arguments field was never populated
Each is now reported separately with the exact TacticalRMM UI path to fix it,
including that global variables come from the Key Store rather than Custom
Fields. No behaviour change for a correctly configured run.
MarkLFT
force-pushed
the
zabbix-arg-validation
branch
from
August 2, 2026 05:41
aed9635 to
525a1a9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The report
Running the Linux Zabbix agent script from TacticalRMM against the newly onboarded Komune / Hotel site failed with:
Accurate, but it doesn't say what to do — and it fires for three different causes that need three different fixes.
What actually happens (traced through TRMM's source, not guessed)
parse_script_args(scripts/models.py:205) passes an argument through unaltered when the resolved value is falsy — so an undefined variable arrives as the literal{{site.ZabbixProxy}}.get_db_value(tacticalrmm/utils.py:320) returns the custom field'sdefault_valuewhen the site has no saved value — normally empty, which TRMM then substitutes as''.So the two cases are distinguishable at the script, and mean opposite things:
{{site.X}}The observed error was the empty case — the
ZabbixProxy/ZabbixServerSite custom fields exist but have no value for the new site.Change
Each case now reports separately with the exact UI path, including the distinction that
{{global.X}}resolves from the Key Store, not Custom Fields — an easy mix-up.All four paths (no args, unresolved site field, blank field, unresolved global) were exercised directly; the blank-field case reproduces the reported failure exactly.
bash -nand shellcheck clean. No behaviour change for a correctly configured run.Related trap found while reading that code — not fixed here
If a Site custom field is undefined,
get_db_valuefalls through to attribute lookup and ends up returning the Site object, which stringifies to the site name. So{{site.ZabbixProxy}}would arrive asHotel— which passes the script's address regex and would silently configureServer=Hotel.The literal-
{{...}}guard added here does not catch that, because TRMM does substitute a value. Options if you want it covered: warn when the address has no dot and is not an IP (risks false positives on short internal hostnames), or resolve it before writing the config. Happy to add either — flagging rather than guessing at the right trade-off.